<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>Formatter (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>

  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
     google.load("visualization", "1", {packages:["orgchart"]});
     var _loadingVisualizations = true;
  </script>

  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
        <span class="fn">debug.Formatter</span>
        <span>Extends</span>
        <span class="fn-name">
          
        </span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    Base class for Formatters. A Formatter is used to format a LogRecord into
something that can be displayed to the user.


  </div>


        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_debug_formatter.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/debug/formatter.js">Git</a></li>
          </ol>
        </div>
</div>






<h2 class="g-first">Inheritance</h2>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
  <tr><td>goog.debug.Formatter</td><td></td></tr>
</table>
</div>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
      <tr><td><span class="type"><a href="class_goog_debug_HtmlFormatter.html">goog.debug.HtmlFormatter</a></span></td><td>goog.debug.Formatter</td></tr>
      <tr><td><span class="type"><a href="class_goog_debug_TextFormatter.html">goog.debug.TextFormatter</a></span></td><td>goog.debug.Formatter</td></tr>
  </table>
</div>




  <h2>Constructor</h2>
      <div class="fn-constructor">
    goog.debug.Formatter(<span><span class="arg">opt_prefix</span></span>)
  </div>

   <h3>Parameters</h3>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">opt_prefix</span>
        : <span class="type">string=</span>
        <div class="entryOverview">The prefix to place before text records.</div>
     </td>
   </tr>
  </table>


<h2>Instance Methods</h2>


  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_debug_Formatter.html">
              goog.debug.Formatter
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.debug.Formatter.prototype.formatRecord"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">formatRecord<span class="args">(<span class="arg">logRecord</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Formats a record.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">logRecord</span>
        : <span class="type"><a href="class_goog_debug_LogRecord.html">goog.debug.LogRecord</a></span>
        <div class="entryOverview">the logRecord to format.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            The formatted string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line98">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.debug.Formatter.prototype.getStartTimeProvider"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getStartTimeProvider<span class="args">()</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_debug_RelativeTimeProvider.html">goog.debug.RelativeTimeProvider</a></span>
      </div>


     <div class="entryOverview">
       Returns the start time provider. By default, this is the default instance
but can be changed.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_debug_RelativeTimeProvider.html">goog.debug.RelativeTimeProvider</a></span>&nbsp;
            The start time provider.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line116">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.debug.Formatter.prototype.resetRelativeTimeStart"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">resetRelativeTimeStart<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Resets the start relative time.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line124">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.debug.Formatter.prototype.setStartTimeProvider"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">setStartTimeProvider<span class="args">(<span class="arg">provider</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Sets the start time provider. By default, this is the default instance
but can be changed.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">provider</span>
        : <span class="type"><a href="class_goog_debug_RelativeTimeProvider.html">goog.debug.RelativeTimeProvider</a></span>
        <div class="entryOverview">The provider to use.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line106">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Instance Properties</h2>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_debug_Formatter.html">
              goog.debug.Formatter
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.appendNewline"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">appendNewline</span>
        : 
     </div>


     <div class="entryOverview">
       Whether to append newlines to the end of formatted log records.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line55">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.prefix_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">prefix_</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line39">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.showAbsoluteTime"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">showAbsoluteTime</span>
        : 
     </div>


     <div class="entryOverview">
       Whether to show absolute time in the DebugWindow.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line62">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.showExceptionText"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">showExceptionText</span>
        : 
     </div>


     <div class="entryOverview">
       Whether to show the logger exception text.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line83">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.showLoggerName"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">showLoggerName</span>
        : 
     </div>


     <div class="entryOverview">
       Whether to show the logger name in the DebugWindow.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line76">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.showRelativeTime"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">showRelativeTime</span>
        : 
     </div>


     <div class="entryOverview">
       Whether to show relative time in the DebugWindow.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line69">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.showSeverityLevel"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">showSeverityLevel</span>
        : 
     </div>


     <div class="entryOverview">
       Whether to show the severity level.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line90">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.debug.Formatter.prototype.startTimeProvider_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">startTimeProvider_</span>
        : <span class="type"><a href="class_goog_debug_RelativeTimeProvider.html">goog.debug.RelativeTimeProvider</a></span>
     </div>


     <div class="entryOverview">
       A provider that returns the relative start time.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line46">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Static Methods</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.debug.Formatter.getDateTimeStamp_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.Formatter.</span><span class="entryName">getDateTimeStamp_<span class="args">(<span class="arg">logRecord</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Returns a string for the time/date of the LogRecord.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">logRecord</span>
        : <span class="type"><a href="class_goog_debug_LogRecord.html">goog.debug.LogRecord</a></span>
        <div class="entryOverview">The record to get a time stamp for.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            A string representation of the time/date of the LogRecord.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line135">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.debug.Formatter.getRelativeTime_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.Formatter.</span><span class="entryName">getRelativeTime_<span class="args">(<span class="arg">logRecord</span>,&nbsp;<span class="arg">relativeTimeStart</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Returns a string for the number of seconds relative to the start time.
Prepads with spaces so that anything less than 1000 seconds takes up the
same number of characters for better formatting.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">logRecord</span>
        : <span class="type"><a href="class_goog_debug_LogRecord.html">goog.debug.LogRecord</a></span>
        <div class="entryOverview">The log to compare time to.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">relativeTimeStart</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The start time to compare to.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            The number of seconds of the LogRecord relative to the
    start time.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line173">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.debug.Formatter.getTwoDigitString_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.Formatter.</span><span class="entryName">getTwoDigitString_<span class="args">(<span class="arg">n</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Returns the number as a two-digit string, meaning it prepends a 0 if the
number if less than 10.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">n</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The number to format.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            A two-digit string representation of <code> n</code>.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_formatter.js.source.html#line155">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package debug</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="debug.Formatter"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
